import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 购物车列表查询 */
export const getShopCarList = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/shoppingCart/page"), {
    params: filerEmptyVal(params)
  });
};

/** 添加购物车 */
export const addShopCart = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/shoppingCart/add"), { data });
};

/** 修改购物车 */
export const upShopCart = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/shoppingCart/update"), {
    data
  });
};

/** 删除购物车 */
export const delShopCart = id => {
  return http.request<any>(
    "post",
    baseUrlApi("/shoppingCart/batch/delete?cartIds=" + id)
  );
};
